/**
 * <p>Copyright:Copyright(c) 2019</p>
 * <p>Company:Professional</p>
 * <p>Package:com.cesgroup.zw.spring.boot.echarts.model</p>
 * <p>File:Richable.java</p>
 * <p>类更新历史信息</p>
 * @todo chanlong(陈龙) 创建于 Jun 4, 2019 2:13:55 PM
 */
package com.cesgroup.zw.spring.boot.echarts.model;

import java.util.HashMap;
import java.util.Map;

import com.cesgroup.zw.spring.boot.echarts.model.style.RichStyle;

/**
 * <p>描述: </p>
 * <p>Company: Professional</p>
 * @author chanlong(陈龙)
 * @date Jun 4, 2019 2:13:55 PM
 * @version 1.0.2019
 */
public interface Richable<T> {

	Map<String, RichStyle> getRich();
	
	void setRich(Map<String, RichStyle> rich);
	
	default Boolean hasRich() {
		return null != getRich();
	}

	@SuppressWarnings("unchecked")
	default T rich(final String key, final RichStyle style) {
		if (!hasRich()) setRich(new HashMap<String, RichStyle>());
		getRich().put(key, style);
		return (T) this;
	}
}
